package command;

import elements.Robot;
/**
 * A class of basic commands representing the shooting operation.
 * 
 * @version	3.0
 * @author 	Lies Tambeur 	r0264469	2Bcwsbbh
 * @author	Eline Vanrykel	r0264543	2Bcwselt
 */
public class Shoot extends BasicCommand {
	/**
	 * Lets the robot shoot once if the robot has enough energy.
	 * @effect	If the robot has enough energy it shoots once.
	 */
	@Override
	public void execute(Robot robot) {
		if(robot.isLegalEnergy(robot.getEnergy().subtractAndReturn(Robot.getEnergyRequiredToShoot()))){
			robot.shoot();
		}
	}
	
	@Override
	public String toString(){
		return "(shoot)";
	}
	
	@Override
	public boolean equals(Object object){
		if(object == null || this==null){
			return false;
		}
		return this.toString().equals(object.toString());
	}
}
